import request from '@/utils/request'

const findDict = (key_: string) =>
  request({
    url: `/dict/code/${key_}`,
    method: 'get'
  })

class Dict {
  key_: string
  label_: string

  constructor(key: string, label: string) {
    this.key_ = key
    this.label_ = label
  }

  public list() {
    return findDict(this.key_)
  }
}

export const DictTypeCode = {
  EDUCATION_BACKGROUND: new Dict('EDUCATION_BACKGROUND', '学历')
}
